import { request, requestOther } from '@/utils/request';
import type { PageData } from '@/api/model/pageModel';
import type {
  capitalModel,
  integralPriceModel,
  integralInfoModel,
  goldInfoModel,
  withdrawInfoModel
} from '@/api/model/capitalModel';

const Api = {
  CapitalInfo: '/capital/info', //资产信息
  IntegralList: '/capital/integral/list',//积分记录
  GoldList: '/capital/gold/list',  //金币记录
  IntegralPrice:'/capital/integral/price',//积分价格
  WithdrawAccount: '/asset/withdraw/info', //提现帐号
  ApplyWithdraw: '/asset/withdraw/apply', //提现申请
  WithdrawOrder: '/order/withdraw', //提现单查询
};


//用户资产
export function fetchCapitalInfo() {
  return request.get<capitalModel>({
    url: Api.CapitalInfo,
  });
}
//积分价格
export function fetchIntegralPrice() {
  return request.get<integralPriceModel>({
    url: Api.IntegralPrice,
  });
}


//积分记录
export function fetchIntegralList(d : any) {
  return request.get<PageData<integralInfoModel>>({
    url: Api.IntegralList + '?page=' + d.page + '&pageSize=' + d.pageSize,
  });
}

//金币记录
export function fetchGoldList(d : any) {
  return request.get<PageData<goldInfoModel>>({
    url: Api.GoldList + '?page=' + d.page + '&pageSize=' + d.pageSize,
  });
}



//变更提现帐号
export function saveWithdrawAccount(d : any) {
  return request.post<object>({
    url: Api.WithdrawAccount,
    data: d
  });
}

//提现申请
export function applyWithdraw(d : any) {
  return request.post<object>({
    url: Api.ApplyWithdraw,
    data: d
  });
}
